]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
grabHelper: consume the press/motion/release sequence if a press dismisses the grab
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 22 Jul 2014 10:50:54 +0000 (12:50 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 31 Jul 2014 08:55:11 +0000 (10:55 +0200)
The grab would previously just consume the button release, while propagating
motion events, possibly down to clients in wayland. This would produce
inconsistent streams there.

On pointer events, the inconsistency would just be having clients receiving
events with the button 1 set in the mask, with no implicit grab. When touch
events are handled, this would be more hindering as the client would receive
touch_motion events with no prior touch_down nor later touch_up, something
never supposed to happen.

https://bugzilla.gnome.org/show_bug.cgi?id=733633

js/ui/grabHelper.js

index ec53deb905f7544bd7b8b319a67505b6f78f6100..c5f76c8cf82defd83cd99c6ebf1c8ac669e4dda9 100644 (file)
@@ -283,12 +283,14 @@ const GrabHelper = new Lang.Class({
             return Clutter.EVENT_STOP;
         }
 
+        let motion = type == Clutter.EventType.MOTION;
         let press = type == Clutter.EventType.BUTTON_PRESS;
         let release = type == Clutter.EventType.BUTTON_RELEASE;
         let button = press || release;
 
-        if (release && this._ignoreRelease) {
-            this._ignoreRelease = false;
+        if (this._ignoreUntilRelease && (motion || release)) {
+            if (release)
+                this._ignoreUntilRelease = false;
             return Clutter.EVENT_STOP;
         }
 
@@ -299,10 +301,11 @@ const GrabHelper = new Lang.Class({
             return Clutter.EVENT_PROPAGATE;
 
         if (button) {
-            // If we have a press event, ignore the next event,
-            // which should be a release event.
+            // If we have a press event, ignore the next
+            // motion/release events.
             if (press)
-                this._ignoreRelease = true;
+                this._ignoreUntilRelease = true;
+
             let i = this._actorInGrabStack(event.get_source()) + 1;
             this.ungrab({ actor: this._grabStack[i].actor, isUser: true });
             return Clutter.EVENT_STOP;